<div class="refentry" lang="en" xml:lang="en"><a id="glLineStipple"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glLineStipple — specify the line stipple pattern</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glLineStipple</b>(</code></td><td>GLint  </td><td><var class="pdparam">factor</var>, </td></tr><tr><td> </td><td>GLushort  </td><td><var class="pdparam">pattern</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>factor</code></em></span></dt><dd><p>
                    Specifies a multiplier for each bit in the line stipple pattern.
                    If <em class="parameter"><code>factor</code></em> is 3,
                    for example,
                    each bit in the pattern is used three times
                    before the next bit in the pattern is used.
                    <em class="parameter"><code>factor</code></em> is clamped to the range [1, 256] and defaults to 1.
                </p></dd><dt><span class="term"><em class="parameter"><code>pattern</code></em></span></dt><dd><p>
                    Specifies a 16-bit integer whose bit pattern determines
                    which fragments of a line will be drawn when the line is rasterized.
                    Bit zero is used first; the default pattern is all 1's.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            Line stippling masks out certain fragments produced by rasterization;
            those fragments will not be drawn.
            The masking is achieved by using three parameters:
            the 16-bit line stipple pattern <em class="parameter"><code>pattern</code></em>,
            the repeat count <em class="parameter"><code>factor</code></em>,
            and an integer stipple counter
            <math overflow="scroll"><mi mathvariant="italic">s</mi></math>.
        </p><p>
            Counter
            <math overflow="scroll"><mi mathvariant="italic">s</mi></math>
            is reset to 0 whenever <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> is called
            and before each line segment of a <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>(<code class="constant">GL_LINES</code>)/<a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>
            sequence is generated.
            It is incremented after each fragment of a unit width aliased line segment
            is generated
            or after each
            <math overflow="scroll"><mi mathvariant="italic">i</mi></math>
            fragments of an
            <math overflow="scroll"><mi mathvariant="italic">i</mi></math>
            width line segment are generated.
            The
            <math overflow="scroll"><mi mathvariant="italic">i</mi></math>
            fragments associated with count
            <math overflow="scroll"><mi mathvariant="italic">s</mi></math>
            are masked out if
        </p><p>
            <em class="parameter"><code>pattern</code></em> bit
            <math overflow="scroll">

                <mrow>
                    <mfenced open="(" close=")">
                        <mfrac>
                            <mi mathvariant="italic">s</mi>
                            <mi mathvariant="italic">factor</mi>
                        </mfrac>
                    </mfenced>
                    <mo>%</mo>
                    <mn>16</mn>
                </mrow>
            </math>
        </p><p>
            is 0, otherwise these fragments are sent to the frame buffer.
            Bit zero of <em class="parameter"><code>pattern</code></em> is the least significant bit.
        </p><p>
            Antialiased lines are treated as a sequence of
            <math overflow="scroll">

                <mrow>
                    <mn>1</mn>
                    <mo>×</mo>
                    <mi mathvariant="italic">width</mi>
                </mrow>
            </math>
            rectangles
            for purposes of stippling.
            Whether rectangle
            <math overflow="scroll"><mi mathvariant="italic">s</mi></math>
            is rasterized or not depends on the fragment rule
            described for aliased lines,
            counting rectangles rather than groups of fragments.
        </p><p>
            To enable and disable line stippling, call <a class="citerefentry" href="glEnable"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and <a class="citerefentry" href="glDisable"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a>
            with argument <code class="constant">GL_LINE_STIPPLE</code>.
            When enabled,
            the line stipple pattern is applied as described above.
            When disabled,
            it is as if the pattern were all 1's.
            Initially, line stippling is disabled.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glLineStipple</code>
            is executed between the execution of <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
            and the corresponding execution of <a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
            <a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LINE_STIPPLE_PATTERN</code>
        </p><p>
            <a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LINE_STIPPLE_REPEAT</code>
        </p><p>
            <a class="citerefentry" href="glIsEnabled"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_LINE_STIPPLE</code>
        </p></div>
        {$pipelinestall}{$examples}
        <div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="glLineWidth"><span class="citerefentry"><span class="refentrytitle">glLineWidth</span></span></a>,
            <a class="citerefentry" href="glPolygonStipple"><span class="citerefentry"><span class="refentrytitle">glPolygonStipple</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
            Copyright © 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/" target="_top">https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></div>
